package com.tbit.uqbike.webmanager.controller;

import com.github.pagehelper.PageInfo;
import com.tbit.uqbike.object.pojo.AccountUserLastPos;
import com.tbit.uqbike.object.view.JsonResult;
import com.tbit.uqbike.service.business.AccountUserService;
import com.tbit.uqbike.webmanager.util.Assert;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName AccountLocation
 * @Description
 * @date 2021/11/15 16:13
 * @Version 1.0
 */
@Validated
@RestController
@Slf4j
@RequestMapping(value = "/accountLocation", produces = BaseController.MEDIA_JSON_UTF8)
public class AccountLocationController extends BaseController {

    @Autowired
    private AccountUserService accountUserService;

    @PostMapping("/queryPage")
    public JsonResult getAccountUserInfo(Integer accountId, Integer pageNO, Integer rowCount) {
        Assert.notNull(accountId, "ver.accountId.notNull");
        startPage();
        List<AccountUserLastPos> list = accountUserService.getAccountUserPointTime(accountId);
        return JsonResult.ok(list, (int) new PageInfo<>(list).getTotal());
    }


}
